A calculational approach to program inversion

نویسنده

  • S.-C. Mu
چکیده

Many problems in computation can be specified in terms of computing the inverseof an easily constructed function. However, studies on how to derive an algorithm froma problem specification involving inverse functions are relatively rare. The aim of thisthesis is to demonstrate, in an example-driven style, a number of techniques to do the job.The techniques are based on the framework of relational, algebraic program derivation.Simple program inversion can be performed by just taking the converse of the program,sometimes known as to “run a program backwards”. The approach, however, does notmatch the pattern of some more advanced algorithms. Previous results, due to Bird andde Moor, gave conditions under which the inverse of a total function can be written asa fold. In this thesis, a generalised theorem stating the conditions for the inverse of apartial function to be a hylomorphism is presented and proved. The theorem is appliedto many examples, including the classical problem of rebuilding a binary tree from itspreorder and inorder traversals.This thesis also investigates into the interplay between the above theorem and pre-vious results on optimisation problems. A greedy linear-time algorithm is derived forone of its instances — to build a tree of minimum height. The necessary monotonicitycondition, though looking intuitive, is difficult to establish. For general optimal bracket-ing problems, however, the thinning strategy gives an exponential-time algorithm. Thereason and possible improvements are discussed in a comparison with the traditional dy-namic programming approach. The greedy theorem is also generalised to a generic formallowing mutually defined algebras. The generalised theorem is applied to the optimalmarking problem defined on non-polynomial based datatypes. This approach deliverspolynomial-time algorithms without the need to convert the inputs to polynomial baseddatatypes, which is sometimes not convenient to do.The many techniques are applied to solve the Countdown problem, a problem de-rived from the popular television program of the same name. Different strategies towardderiving an efficient algorithm are experimented and compared.Finally, it is shown how to derive from its specification the inverse of the Burrows-Wheeler transform, a string-to-string transform useful in compression. Not only do weidentify the key property why the inverse algorithm works, but, as a bonus, we also outlinehow two generalisations of the transform may be derived.Most of the main part of this thesis has been published or is under preparation to bepublished. Chapter 4 and Chapter 7 have been published as [68] and [19] respectively.Journal versions of these articles have been submitted. The first two sections of Chapter5 has been published in [18]. The full proof in Section 5.1.2, however, is only seen in thisthesis. We are currently preparing an article covering Chapter 6.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Program Optimizations and Transformations in Calculation Form

The world of program optimization and transformation takes on a new fascination when viewed through the lens of program calculation. Unlike the traditional fold/unfold approach to program transformation on arbitrary programs, the calculational approach imposes restrictions on program structures, resulting in some suitable calculational forms such as homomorphisms and mutumorphisms that enjoy a ...

متن کامل

Automated Theorem Prover Assisted Program Calculations

Calculational Style of Programming, while very appealing, has several practical difficulties when done manually. Due to the large number of proofs involved, the derivations can be cumbersome and errorprone. To address these issues, we have developed automated theorem provers assisted program and formula transformation rules, which when coupled with the ability to extract context of a subformula...

متن کامل

Program Inversion in the Refinement Calculus

We present a calculational method for inverting programs by inverting the components separately. This is made possible by using assertions as commands and by permitting constructs that exhibit angelic nondeterminism. Rules are given for transforming inverted programs so that the angelic constructs are removed. A simple example illustrates the method.

متن کامل

Relations, graphs and programs

Much emphasis has been placed in recent years on deriving or calculating programs rather than proving them correct. Adequate calculational frame­ works are needed to support such an approach. This thesis explores the use of a calculus of binary relations to express and reason about graph-theoretical concepts in the context of program construction. Since graphs playa promi­ nent role in algorith...

متن کامل

A calculational approach to path-based properties of the Eisenstein-Stern and Stern-Brocot trees via matrix algebra

This paper proposes a calculational approach to prove properties of two well-known binary trees used to enumerate the rational numbers: the Stern-Brocot tree and the Eisenstein-Stern tree (also known as CalkinWilf tree). The calculational style of reasoning is enabled by a matrix formulation that is well-suited to naturally formulate path-based properties, since it provides a natural way to ref...

متن کامل

Comparing Geostatistical Seismic Inversion Based on Spectral Simulation with Deterministic Inversion: A Case Study

Seismic inversion is a method that extracts acoustic impedance data from the seismic traces. Source wavelets are band-limited, and thus seismic traces do not contain low and high frequency information. Therefore, there is a serious problem when the deterministic seismic inversion is applied to real data and the result of deterministic inversion is smooth. Low frequency component is obtained fro...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2003